<html>

<head>

<?php

include "../includes/constants.php";
include "../includes/functions.php";

?>

<title></title>

<script src="../includes/functions.js"></script>

</head>

<body>

<?php

if ($_GET[id]) {
	$q_spell = "SELECT * FROM spells_new WHERE id='" . $_GET[id] . "'";
	$r_spell = mysql_query($q_spell,$db);
	if ($row_spell = mysql_fetch_array($r_spell)) {
		$q_dbstr = "SELECT text FROM dbstr_us WHERE id1='" . $row_spell[id] . "' AND id2='6'";
		$r_dbstr = mysql_query($q_dbstr,$db);
		$row_dbstr = @mysql_fetch_array($r_dbstr);
			
?>

<img src="../images/icons-spell_gems/<?php echo $row_spell[new_icon]; ?>.gif" height="48" width="48" align="right">
Spell: <?php echo $row_spell[name]; ?><br>
Level: <?php

		$low_level = 70;
		for ($x = 1; $x <= 16; $x++) {
			if ($row_spell["classes{$x}"] != 255) echo $ClassesShort[$x] . "(" . $row_spell["classes{$x}"] . ") ";
			if ($row_spell["classes{$x}"] < $low_level) $low_level = $row_spell["classes{$x}"];
		}

?><br>
Skill: <?php echo $Skills[$row_spell[skill]]; ?><br>
Mana Cost: <?php echo $row_spell[mana]; ?><br>
Cast Time: <?php echo round($row_spell[cast_time] / 1000, 1); ?><br>
<br>
Spell Effect: <?php echo GetSpellText($row_spell[id]); ?><br>
<br>
Spell Details:<br>
<table border="0">
	<tr>
		<td>Slot</td>
		<td>Description</td>
	</tr>
<?
		for ($x = 1; $x <= 12; $x++) {
			if ($row_spell["effectid{$x}"] < 254) {
?>
	<tr>
		<td align="right"><?php echo $x . ":"; ?></td>
		<td><?php echo GetSpellDescription($row_spell["effectid{$x}"], $row_spell["formula{$x}"], $row_spell["effect_base_value{$x}"], $row_spell["effect_limit_value{$x}"], $row_spell["max{$x}"], $low_level, $_GET[level]); ?></td>
	</tr>
<?
			}
		}
?>
</table>

<?php
	} else {
		echo "Spell not found!";
	}
} else {
	echo "<form name=\"NoID\" method=\"GET\" action=\"\">Enter ID: <input type=\"text\" name=\"id\" size=\"2\"><br>\n";
}

?>

</body>

</html>